
public class SizeWindow extends View implements RectangularButtonDelegate {
	Shape s;
	closeButton cb;
	TextBox pixelWidth, pixelHeight, realWidth, realHeight;
	RectangularButton saveData;
	public SizeWindow(float x_, float y_, float w_, float h_, MainView p, Shape s) {
		super(x_, y_, w_, h_, p);
		this.s = s;
		this.cb = new closeButton(w-22,2,20,20,p,this);
		this.subviews.add(this.cb);
		//public TextBox(float x_, float y_, float w_, float h_,MainView p, String d)
		this.pixelHeight = new TextBox(10,50,180,30,p,"Enter Pixel Height");
		this.subviews.add(this.pixelHeight);
		this.pixelWidth = new TextBox(10,90,180,30,p,"Enter Pixel Width");
		this.realHeight = new TextBox(10,130,180,30,p,"Enter Real Height");
		this.realWidth = new TextBox(10,170,180,30,p,"Enter Real Width");
		this.subviews.add(this.pixelWidth);
		this.subviews.add(this.realHeight);
		this.subviews.add(this.realWidth);
		this.saveData = new RectangularButton(50,210, 100,30,p,1);
		this.saveData.setDelegate(this);
		this.saveData.setCaption("Save");
		this.subviews.add(this.saveData);
		// TODO Auto-generated constructor stub
	}
	void drawContent()
	  {
		if(s.type == 1){
			parent.strokeWeight(4);
			  parent.stroke(176,23,31);	
		}
		else{
			parent.strokeWeight(4);
			parent.stroke(67,110,238);
		}
		
		
		//parent.noStroke();
		parent.fill(255);
		parent.rect(0,0,w,h);
	  }
	
	boolean mousePressed(float px, float py)
	{
		pixelWidth.setActivated(false);
		pixelHeight.setActivated(false);
		realWidth.setActivated(false);
		realHeight.setActivated(false);
		return super.mousePressed(px, py);
	}
	
	@Override
	public void RectangularButtonPressed(int id) {
		// TODO Auto-generated method stub
		if(id == 0)
		parent.mainView.subviews.remove(this);
		try{
		if(id == 1){
			if(!this.pixelHeight.getText().equals("")){
				this.s.h=Integer.parseInt(this.pixelHeight.getText());
			}
			if(!this.pixelWidth.getText().equals("")){
				this.s.w=Integer.parseInt(this.pixelWidth.getText());
			}
			if(!this.realHeight.getText().equals("")){
				this.s.realY=Integer.parseInt(this.realHeight.getText());
			}
			if(!this.realWidth.getText().equals("")){
				this.s.realX=Integer.parseInt(this.realWidth.getText());
			}
		}
		}
		catch(NumberFormatException e){
			System.out.println("Error caught");
		}
	}

}
